﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>


</head>
<body>
	<div class="ibox-content">

		<form class="form-horizontal" id="dataform"
			onsubmit="javascripr:return false;">

			<div class="form-group" v-for="config in configs">
				<label class="col-sm-3 control-label">{{config.typeName}}</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" v-model="config.value">
				</div>
			</div>



			<div class="form-group ">
				<div class="col-sm-12 text-center">
					<a href="javascript:;" @click="submit()"
						class="btn btn-success radius"><i class="fa fa-check"></i> 保存</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a class="btn btn-danger radius" href="javascript:;"
						onclick="MTools.closeForm()"><i class="fa fa-close"></i> 关闭</a>
				</div>
			</div>

		</form>
	</div>
	<script type="text/javascript"
		src="${path }/resource/js/systools/MJsBase.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
	<script type="text/javascript">
		var app = new Vue(
				{
					el : '#dataform',
					data : {
						configs : [],
					},
					methods : {
						loadData : function() {
							$.AjaxProxy({
								p : {
									parentId : 1
								}
							}).invoke(
									"${path}/do/admin/dataDictionary/showAll",
									function(loj) {
										app.configs = loj.getValue("rows");
										console.log(app.configs);
									});
						},
						submit : function() {
							var configs = this.configs;
							for (var i = 0; i < configs.length; i++) {
								$
										.AjaxProxy({
											p : {
												id : configs[i].id,
												value : configs[i].value,
											}
										})
										.invoke(
												"${path}/do/admin/dataDictionary/modifyDataDictionary",
												function(loj) {
													console.log(loj
															.getValue("info"));
												});
							}
						}
					},
				});

		app.loadData();
	</script>
</body>
</html>